package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppGasDataMapper;
import com.ep.modules.app.entity.AppGasData;
import com.ep.modules.app.entity.AppGasDataExample;
import com.ep.modules.app.service.AppGasDataService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppGasDataServiceImpl implements AppGasDataService {
    @Autowired
    private AppGasDataMapper appGasDataMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppGasDataExample example = new AppGasDataExample();
        AppGasDataExample.Criteria criteria = example.createCriteria();
        List<AppGasData> list = appGasDataMapper.selectByExample(example);
        Page<AppGasData> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppGasData getById(Long id) {
        return appGasDataMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppGasData entity) {
        appGasDataMapper.insert(entity);
    }

    public void update(AppGasData entity) {
        appGasDataMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appGasDataMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}